<template>
  <div>
    <el-dialog title="编辑" :visible.sync="dialogVisible" width="60%">
      <el-row style="margin-top:1rem;">
        <el-col :span="3">
          <div style="text-align:right;padding:0.5rem;">职位：</div>
        </el-col>
        <el-col :span="20">
          <el-input placeholder="模板名不可重复" v-model="q.jobPosition" clearable>
          </el-input>
        </el-col>
      </el-row>
      <el-row style="margin-top:1rem;">
        <el-col :span="3">
          <div style="text-align:right;padding:0.5rem;">表达式：</div>
        </el-col>
        <el-col :span="20">
          <el-input placeholder="请输入内容" v-model="q.expression" clearable>
          </el-input>
        </el-col>
      </el-row>
      <el-row style="margin-top:1rem;">
        <el-col :span="3">
          <div style="text-align:right;padding:0.5rem;">序号：</div>
        </el-col>
        <el-col :span="20">
          <el-input placeholder="请输入内容" v-model="q.sortNum" clearable>
          </el-input>
        </el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="submit">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
  export default {
    data: function () {
      return {
        dialogVisible: false,
        q: {
          jobPosition: "",
          expression: "",
          sortNum: "",
        }
      }
    },
    methods: {
      init(row) {
        this.dialogVisible = true
        this.q = row
      },
      submit() {
        this.$http({
          url: `${this.$http.adornUrl('/jobPositionMatching/?token='+this.$cookie.get('token') )}`,
          method: 'put',
          data: this.$http.adornParams(this.q)
        }).then(data => {
          if(data.data.code==0){
            this.$message({
                message: '更新成功',
                type: 'success'
              });
              this.$emit('fnc')
              this.dialogVisible = false
          }else{
            this.$message({
                message: '更新失败',
                type: 'error'
              });
          }
        })
      }
    }

  }

</script>
